<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<title>Exported from Notepad++</title>
<style type="text/css">
span {
	font-family: 'Courier New';
	font-size: 10pt;
	color: #000000;
}
.sc0 {
}
.sc1 {
	font-style: italic;
	color: #0000FF;
}
.sc2 {
	font-style: italic;
	color: #0000FF;
}
.sc4 {
	color: #8000FF;
}
.sc5 {
	font-weight: bold;
	font-style: italic;
	color: #0000FF;
}
.sc6 {
	font-weight: bold;
	color: #008000;
}
.sc8 {
	font-weight: bold;
	font-style: italic;
	color: #008000;
}
.sc10 {
	font-weight: bold;
	color: #0080FF;
}
.sc11 {
}
</style>
</head>
<body>
<div style="float: left; white-space: pre; line-height: 1; background: #FFFFFF; "><span class="sc2">// ================================================================== //</span><span class="sc0">
</span><span class="sc2">// ================ STDLIB.BOP - BEBOP Framework 1.0 ================ //</span><span class="sc0">
</span><span class="sc2">// ================= BEBOP STANDARD TEMPLATE LIBRARY ================ //</span><span class="sc0">
</span><span class="sc2">// ================================================================== //</span><span class="sc0">

</span><span class="sc2">/// &lt;h2&gt;Define standards&lt;/h2&gt;</span><span class="sc0">

</span><span class="sc10">#</span><span class="sc5">define</span><span class="sc0"> </span><span class="sc8">LINUX</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0">
</span><span class="sc10">#</span><span class="sc5">define</span><span class="sc0"> </span><span class="sc8">WINDOWS</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">

</span><span class="sc2">/// &lt;h2&gt;Composants standards pour circuits digitaux synchrones bebop&lt;/h2&gt;</span><span class="sc0">

</span><span class="sc2">// PROLONGEMENT des primitives, pour vecteur:[N]</span><span class="sc0">

</span><span class="sc1">/** 
    id[N] : branchement identité signaux à signaux    
    @param a:[N]
    @return b:[N] 
*/</span><span class="sc0">
</span><span class="sc6">id</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">b</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">idi</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">idi</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">idi</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc1">/**
    MUX[N] : multiplexer sur N bits
    @param c : enable
    @param d1:[N] valeur si c = vdd
    @param d2:[N] valeur si c = gnd
    @return s:[N] d1 ou d2 selon c
*/</span><span class="sc0">
</span><span class="sc6">mux</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">c</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">d1</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">d2</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">k</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">s</span><span class="sc10">[</span><span class="sc11">k</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">mux</span><span class="sc10">(</span><span class="sc11">c</span><span class="sc10">,</span><span class="sc11">d1</span><span class="sc10">[</span><span class="sc11">k</span><span class="sc10">],</span><span class="sc11">d2</span><span class="sc10">[</span><span class="sc11">k</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc6">gnd</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]()=(</span><span class="sc0"> </span><span class="sc11">g</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">D</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">g</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">gnd</span><span class="sc10">();</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc6">vdd</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]()=(</span><span class="sc11">v</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">v</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">vdd</span><span class="sc10">();</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc6">and</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">s</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc4">0</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc4">0</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">and</span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
    </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">b</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">]);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc6">or</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">s</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc4">0</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc4">0</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">or</span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
    </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">b</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">]);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc6">not</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">s</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">not</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc6">reg</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">s</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">reg</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc6">regen</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">en</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">j</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">s</span><span class="sc10">[</span><span class="sc11">j</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">regen</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">j</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">en</span><span class="sc10">);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">


</span><span class="sc2">// Test d'egalite sur 2 mots de N bits</span><span class="sc0">

</span><span class="sc8">EQUALS</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">s</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">q</span><span class="sc10">[-</span><span class="sc4">1</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">vdd</span><span class="sc10">();</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">q</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">and</span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">q</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">-</span><span class="sc4">1</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc6">or</span><span class="sc10">(</span><span class="sc6">and</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">],</span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]),</span><span class="sc6">and</span><span class="sc10">(</span><span class="sc6">not</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]),</span><span class="sc0"> </span><span class="sc6">not</span><span class="sc10">(</span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]))));</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
    </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">q</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">-</span><span class="sc4">1</span><span class="sc10">]);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc1">/** 
    Arbre brut de decision binaire
    @param N : nombre de feuilles. 
    @param D : nombre de bits de donnes
    donc logN bits de decisions
    @input input:[N]:[D] un arbre complet de N feuilles de longueur D
    @input deci:[log(N)] les bits de contrôle pour la décision
    @output s:[D] la valeur de la bonne feuille
    les bits de contrôle s'entendent poids faibles à gauche, 
    et les feuilles sont numérotées à partir de 0.
*/</span><span class="sc0">
</span><span class="sc8">BDD</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">][</span><span class="sc8">D</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc5">input</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">deci</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc6">log</span><span class="sc10">(</span><span class="sc8">N</span><span class="sc10">)]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">br</span><span class="sc10">[</span><span class="sc4">0</span><span class="sc10">][</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]=</span><span class="sc0"> </span><span class="sc8">ID</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">](</span><span class="sc5">input</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc6">log</span><span class="sc10">(</span><span class="sc8">N</span><span class="sc10">)</span><span class="sc0">
        </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">j</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc11">/</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc4">2</span><span class="sc0"> </span><span class="sc10">^</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
            </span><span class="sc11">br</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">][</span><span class="sc11">j</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">MUX</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">](</span><span class="sc0"> </span><span class="sc11">deci</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">br</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">][</span><span class="sc4">2</span><span class="sc11">*j</span><span class="sc0"> </span><span class="sc10">+</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">br</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">][</span><span class="sc4">2</span><span class="sc11">*j</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]);</span><span class="sc0">
        </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
    </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">ID</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">](</span><span class="sc11">br</span><span class="sc10">[</span><span class="sc6">log</span><span class="sc10">(</span><span class="sc8">N</span><span class="sc10">)][</span><span class="sc4">0</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc1">/**
    Copier le signal N fois
    @param N
    @input a
    @return b:[N] &lt;=&gt; a, a, a, a, etc...
*/</span><span class="sc0">
</span><span class="sc8">VECTORIZE</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc11">a</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=(</span><span class="sc11">b</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">b</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc8">FULL_ADDER</span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">c</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">s</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">r</span><span class="sc10">)</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">xor</span><span class="sc10">(</span><span class="sc6">xor</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">,</span><span class="sc11">b</span><span class="sc10">),</span><span class="sc11">c</span><span class="sc10">);</span><span class="sc0">
    </span><span class="sc11">r</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">or</span><span class="sc10">(</span><span class="sc6">or</span><span class="sc10">(</span><span class="sc0"> </span><span class="sc6">and</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">,</span><span class="sc11">b</span><span class="sc10">),</span><span class="sc0"> </span><span class="sc6">and</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">,</span><span class="sc11">c</span><span class="sc10">)),</span><span class="sc6">and</span><span class="sc10">(</span><span class="sc11">b</span><span class="sc10">,</span><span class="sc11">c</span><span class="sc10">));</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc1">/** 
 * Registre machine avec retard et enable
 * @param en enable rester ou bouger
 * @param set valeur proposee si enable
 * @return get la valeur interne
 */</span><span class="sc0">
</span><span class="sc8">RegMCBit</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">en</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">set</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">get</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">get</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">u</span><span class="sc10">;</span><span class="sc0"> </span><span class="sc2">// get non disponible à droite pour la compatibilité export</span><span class="sc0">
    </span><span class="sc11">u</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">Z</span><span class="sc10">(</span><span class="sc6">mux</span><span class="sc10">(</span><span class="sc11">en</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">set</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">u</span><span class="sc10">));</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">/// Registre machine version N bits</span><span class="sc0">
</span><span class="sc8">RegMC</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">en</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">set</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">])</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">get</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc10">-</span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">get</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">RegMCBit</span><span class="sc10">(</span><span class="sc11">en</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">set</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">//Compteur elementaire de 1 bit</span><span class="sc0">
</span><span class="sc8">CM2</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">in</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">s</span><span class="sc10">,</span><span class="sc11">r</span><span class="sc10">)</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
  </span><span class="sc11">s</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">xor</span><span class="sc10">(</span><span class="sc11">in</span><span class="sc10">,</span><span class="sc11">ro</span><span class="sc10">);</span><span class="sc0"> 
  </span><span class="sc11">ro</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">reg</span><span class="sc10">(</span><span class="sc11">s</span><span class="sc10">);</span><span class="sc0">
  </span><span class="sc11">r</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">and</span><span class="sc10">(</span><span class="sc11">in</span><span class="sc10">,</span><span class="sc11">ro</span><span class="sc10">);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">//Compteur modulo N=2^D</span><span class="sc0">
</span><span class="sc8">CM</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">](</span><span class="sc11">in</span><span class="sc10">)=(</span><span class="sc11">out</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">with</span><span class="sc0"> </span><span class="sc5">unused</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">r</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">-</span><span class="sc4">1</span><span class="sc10">]</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
        </span><span class="sc11">r</span><span class="sc10">[-</span><span class="sc4">1</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">in</span><span class="sc10">);</span><span class="sc0">
        </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">D</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
            </span><span class="sc11">out</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">],</span><span class="sc11">r</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">CM2</span><span class="sc10">(</span><span class="sc11">r</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">]);</span><span class="sc0">
        </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">//Diviseur d'horloge modulo 2^D</span><span class="sc0">
</span><span class="sc8">DIVTIME</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">](</span><span class="sc11">in</span><span class="sc10">)=(</span><span class="sc11">out</span><span class="sc10">)</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">out</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">not</span><span class="sc10">(</span><span class="sc0"> </span><span class="sc6">or</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc0"> </span><span class="sc8">CM</span><span class="sc10">[</span><span class="sc8">D</span><span class="sc10">](</span><span class="sc11">in</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">// ALU</span><span class="sc0">

</span><span class="sc2">// Addition Binaire sur AR bits, avec retenue d'entree et retenue de sortie</span><span class="sc0">
</span><span class="sc8">ADD</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc11">r0</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">r1</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">carry_in</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">nr1</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">carry_out</span><span class="sc10">)</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
        </span><span class="sc11">c</span><span class="sc10">[</span><span class="sc4">0</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">carry_in</span><span class="sc10">);</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">0</span><span class="sc0"> </span><span class="sc5">to</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc10">-</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc0">
        </span><span class="sc11">nr1</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">],</span><span class="sc11">c</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">+</span><span class="sc4">1</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">FULL_ADDER</span><span class="sc10">(</span><span class="sc11">r0</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">],</span><span class="sc11">r1</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">],</span><span class="sc11">c</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">
    </span><span class="sc2">//flag de debordement</span><span class="sc0">
    </span><span class="sc11">carry_out</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">id</span><span class="sc10">(</span><span class="sc11">c</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">// Soustraction : a - b = a + 1 + 2^AR - 1 -b = a + 1 + not(b)</span><span class="sc0">
</span><span class="sc8">SUB</span><span class="sc10">[</span><span class="sc8">AR</span><span class="sc10">](</span><span class="sc11">a</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">AR</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">AR</span><span class="sc10">])</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc0"> </span><span class="sc11">r</span><span class="sc0"> </span><span class="sc10">:</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc8">AR</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">)</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
        </span><span class="sc11">r</span><span class="sc10">:[</span><span class="sc8">AR</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">_</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">ADD</span><span class="sc10">[</span><span class="sc8">AR</span><span class="sc10">](</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">AR</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc8">NOT</span><span class="sc10">[</span><span class="sc8">AR</span><span class="sc10">](</span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">AR</span><span class="sc10">]),</span><span class="sc0"> </span><span class="sc6">vdd</span><span class="sc10">());</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">// Predecedent non optimise</span><span class="sc0">
</span><span class="sc8">PRED</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">r</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">r</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">SUB</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc8">GND</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">-</span><span class="sc4">1</span><span class="sc10">]());</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">// Successeur non optimise</span><span class="sc0">
</span><span class="sc8">SUCC</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">r</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">r</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">_</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">ADD</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc8">GND</span><span class="sc10">[</span><span class="sc8">N</span><span class="sc10">](),</span><span class="sc0"> </span><span class="sc4">1</span><span class="sc10">);</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">// TODO : optimisation des blocs PRED et SUCC</span><span class="sc0">
</span><span class="sc2">// Alu partagee</span><span class="sc0">

</span><span class="sc2">// Front montant</span><span class="sc0">
</span><span class="sc8">Posedge</span><span class="sc0"> </span><span class="sc11">c</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">en</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">en</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">and</span><span class="sc10">(</span><span class="sc11">c</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc6">not</span><span class="sc10">(</span><span class="sc6">Z</span><span class="sc10">(</span><span class="sc11">c</span><span class="sc10">)));</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">

</span><span class="sc2">// Front descendant</span><span class="sc0">
</span><span class="sc8">Negedge</span><span class="sc0"> </span><span class="sc11">c</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">en</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc11">en</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">and</span><span class="sc10">(</span><span class="sc6">not</span><span class="sc10">(</span><span class="sc11">c</span><span class="sc10">),</span><span class="sc0"> </span><span class="sc6">Z</span><span class="sc10">(</span><span class="sc11">c</span><span class="sc10">));</span><span class="sc0">
</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">
</span></div></body>
</html>
